<?php

require("../file/Sajax.php");

function getCursos($ciclo){
	
	$cnt=0;

	$cursos.="Cursos: <select id=\"Provinces\" >";
	$crusos.="<option value=\"\">Seleccione el curso</option>";

	$ree=mysql_query("SELECT * FROM Province WHERE CountryCode='$CountryID' AND (ProvinceCode!=0 || CountryCode='US')") or die(mysql_error());
	
	while($rww=mysql_fetch_array($ree)){
		
		$cnt++;
		$ProvinceStr.="<option value='" . $rww[ProvinceCode] . "'>" . htmlspecialchars(utf8_encode($rww[ProvinceName])) . "</option>";
	}
	
	$cursos.="</select>";
	return $cursos;
}

function getCities($CountryID, $ProvinceID){
	
	if(strlen(trim($ProvinceID)) == 1) $ProvinceID="0" . $ProvinceID;

	$CitiesStr.="<select id=\"CityID\">";
	$re=mysql_query("SELECT * FROM Countries WHERE ADM1='$ProvinceID' AND CC1='$CountryID' ORDER BY FULL_NAME") or die(mysql_error());

	while($rw=mysql_fetch_array($re)){
		
		$CitiesStr.="<option value='" . $rw[FULL_NAME] . "'>" . htmlspecialchars(utf8_encode($rw[FULL_NAME])) . "</option>";
	}

	$CitiesStr.="</select>";
	return $CitiesStr;
}

sajax_init();
// $sajax_debug_mode = 1;

sajax_export("getProvinces");
sajax_handle_client_request();

?>